var request = require("superagent");

function getInfo() {
    request.post('https://wx.17u.cn/flightorderdetail/order/orderdetailfeenew')
        .set("tcsectoken", '027093039245106135243230197030056045202015212082190244053038211091054223246238095172074148068195091131052177225139141156068169107072219105044138127221143226198081138003204059159017138172156242009162017104101250028125070084005152049053241031101057237207048010011057028115206203246093081221209059155243085132183181')
        .type('form')
        .send({
            IsMuilteSite: 1,
            MemberId: "289184525",
            airlineType: 1,
            originMemberId: "ZGG1clqLuvz9a0fh79ngPw==",
            plat: 518,
            serialNo: "ODEXE26QD10M7S004525"
        })
        .end(function (err, res) {
            if (err) {
                console.log(err)
            } else {
                var resJson = JSON.parse(res.text);
                var fee = resJson.body.transInfos[0].segments[0].itemDetails;
                var lastFee = 0;
                var lastItemName = '';
                for (var i = 0; i < fee.length; i++) {
                    lastFee += fee[i].itemUnitPrice * fee[i].itemNums;
                    lastItemName += fee[i].itemName + '(' + fee[i].itemUnitPrice + 'x' + fee[i].itemNums + ')';

                    var detail = '';
                    for (var j = 0; j < fee[i].subItems.length; j++) {
                        detail += fee[i].subItems[j].subItemName + '(' + fee[i].subItems[j].subItemPrice + 'x' + fee[i].subItems[j].subItemNums + ')';
                    }
                    console.log(detail);
                }
                console.log(fee);
                console.log(lastItemName);
            }
        })
}

getInfo();

